package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 互动提问的问题表 前端控制器
 * </p>
 *
 * @author 东哥
 * @since 2024-08-25
 */
@Api(tags = "互动问答-管理端-问题相关接口")
@RestController
@RequestMapping("/admin/questions")
@RequiredArgsConstructor
public class InteractionQuestionAdminController {
    private final IInteractionQuestionService questionService;


    /**
     * 1、分页查询互动问题（Day5 - 随堂4）
     */
    @ApiOperation("分页查询互动问题")
    @GetMapping("page")
    public PageDTO<QuestionAdminVO> pageQuery(QuestionAdminPageQuery query){
        return questionService.adminPageQuery(query);
    }
    /**
     * 2.根据ID查询问题详情
     */
    @ApiOperation("根据ID查询问题详情")
    @GetMapping("{id}")
    public QuestionAdminVO queryByIds(@PathVariable("id") Long id){
        return questionService.queryByIds(id);
    }
    /**
     * 3.隐藏与显示问题
     */
    @ApiOperation("隐藏与显示问题")
    @PutMapping("{id}/hidden/{hidden}")
    public void hiddenOrShow(@PathVariable("id") Long id,@PathVariable("hidden") Boolean hidden){
        questionService.hiddenOrShow(id,hidden);
    }



}
